import request from "@/plugins/request";

var pre = "";
if (process.env.NODE_ENV !== "development") {
  pre = "/api/sa/eshop";
}

//平台分类
export function queryGetList(data) {
  return request({
    url: `${pre}/common/platform-category/list?categoryCode=${data}`,
    method: "get",
  });
}

// 平台商品分类树
export function queryCtegory(data) {
  return request({
    url: `${pre}/common/platform-category/tree/get`,
    method: "get",
    data,
  });
}

//当前用户管理的网点经销商
export function queryDealer() {
  return request({
    url: `${pre}/common/dealer/admin/list`,
    method: "get",
  });
}

// 查询当前用户可查看的经销商
export function queryUser() {
  return request({
    url: `${pre}/common/dealer/user/list`,
    method: "get",
  });
}

//平台店铺分类
export function queryListPage() {
  return request({
    url: `${pre}/common/site-category/admin/list`,
    method: "get",
  });
}

// 根据网点查询商品分类
export function queryShopPage(data) {
  return request({
    url: `${pre}/common/site-category/network/list?networkId=${data}`,
    method: "get",
  });
}

// 查询商品分类(平台)详情
export function queryDetail(data) {
  return request({
    url: `${pre}/platform-category/get?categoryCode=${data}`,
    method: "get",
  });
}

// 删除商品分类(平台)
export function deleteCtegory(data) {
  return request({
    url: `${pre}/platform-category/del?categoryCode=${data}`,
    method: "get",
  });
}

// 保存商品分类(平台)
export function categorySave(data) {
  return request({
    url: `${pre}/platform-category/save`,
    method: "post",
    data,
  });
}

//查询当前用户管理的销售网点
export function queryOutlets() {
  return request({
    url: `${pre}/common/dealer-network-admin/list`,
    method: "get",
  });
}

//查询当前用户管理的销售网点及分类
export function queryNetwork() {
  return request({
    url: `${pre}/common/dealer-network/network-category/list`,
    method: "get",
  });
}

// 根据销售网点标识查询供应商
export function querySupplier(data) {
  return request({
    url: `${pre}/common/supplier/list?networkId=${data}`,
    method: "get",
  });
}

// 查询结算中心
export function querySettlement(data) {
  return request({
    url: `${pre}/common/settlement-center/list?corpId=${data}`,
    method: "get",
  });
}
